<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var b = true;
        var a = prompt("请输入一个数字");
        for (let index = 2; index < a; index++) {
            
            if (a % index == 0) {

                b = false;
            } 
            
        }
        if(b == true){
            document.write("是质数");
        }else{
            document.write("不是质数");
        }

    </script>
</head>
<body>
    
</body>
</html>